
article_type = {
    1: 'PHP开发',
    2: 'Java开发',
    3: 'Python开发',
    4: 'Web前端',
    5: '测试开发',
    6: '数据科学',
    7: '网络安全',
    8: '蜗牛杂谈'
}


class ArticleUtil:
    def __init__(self):
        pass

    @staticmethod
    def transform_type(article):
            article['type'] = article_type[article.get('type')]
            return article
    @staticmethod
    def transform_date(article):
            article['createtime'] = article['createtime'].strftime('%Y-%m-%d %H:%M:%S')
            article['updatetime'] = article['updatetime'].strftime('%Y-%m-%d %H:%M:%S')
            return article
    @staticmethod
    def transform_articles(article_list):
            for article in article_list:
                article = ArticleUtil.transform_type(article)
                article = ArticleUtil.transform_date(article)
            return article_list